package com.seeingtv.common.utils.sequence;

import java.util.UUID;

/**
 * @author hubert
 * @date 2018/11/1
 * @description IdWorker
 */
public class IdWorker {
	/**
	 * 主机和进程的机器码
	 */
	private static final Sequence worker = new Sequence();

	public static long getId() {
		return worker.nextId();
	}

	public static String getIdStr() {
		return String.valueOf(worker.nextId());
	}

	/**
	 * <p>
	 * 获取去掉"-" UUID
	 * </p>
	 */
	public static synchronized String get32UUID() {
		return UUID.randomUUID().toString().replace("-", "");
	}

	public static void main(String[] args) {
		for (int i = 0; i < 1000 ; i++) {
			System.out.println(getId());
		}
	}
}
